package com.xsd.flyWeight;

/**
 * @Description:
 * @Author: zhoufuzong
 * @Created: 2021-02-28 15:33:42
 * @Version: 1.1.0
 */

public class Client {
    public static void main(String[] args) {
        // 创建一个工厂类
        WebSiteFactory factory = new WebSiteFactory();
        // 客户要一个以新闻形式发布的网站
        WebSite webSite1 = factory.getWebSiteCategrory("新闻");
        webSite1.use(new User().setName("tom"));

        // 客户要求一个以博客形式发布的网站
        WebSite webSite2= factory.getWebSiteCategrory("博客");
        webSite2.use(new User().setName("jack"));

        // 客户要求一个以博客形式发布的网站
        WebSite webSite3= factory.getWebSiteCategrory("博客");
        webSite3.use(new User().setName("cat"));

        System.out.println("工厂对象个数:"+factory.getWebSiteCount());

    }
}
